<?php


// right_cells
echo '<div class="right_cells">';

// cell_edit
$edit_url = array('action' => 'edit', 'id' => $row[$model][$primary_key], 'autoPage' => TRUE);
echo '<div class="cell cell_edit">' . $html->link($routine->icon('pencil'), $edit_url, array('title' => __('edit_action', TRUE), 'escape' => FALSE)) . '</div>';

// cell_preview
if (is_file(VIEWS . $this->params['controller'] . DS . 'view' . $this->ext)) {
	$preview_url = array('action' => 'view', 'id' => $row[$model][$primary_key], 'admin' => FALSE, 'preview' => TRUE, 'autoPage' => FALSE);
	echo '<div class="cell cell_menu cell_preview">' . $html->link($routine->icon('zoom'), $preview_url, array('title' => __('preview_action', TRUE), 'target' => '_preview', 'escape' => FALSE)) . '</div>';
}

// cell_empty / cell_top / cell_up / cell_down / cell_bottom
$_position = TRUE;
if (isset($has_rubric) && $has_rubric && !isset($rubric_id)) {
	$_position = FALSE; // no positioning without rubric
}
if ($_position && isset($field_schema['position'])) {
	if ($i === 0) {
		// cell_empty
		echo str_repeat('<div class="cell cell_empty cell_nbsp">&nbsp;</div>', 2);
	} else {
		// cell_top
		$top_url = array('action' => 'top', 'id' => $row[$model][$primary_key], 'autoPage' => TRUE);
		echo '<div class="cell cell_menu cell_top">' . $html->link($routine->icon('bullet_arrow_top'), $top_url, array('title' => __('top_action', TRUE), 'escape' => FALSE)) . '</div>';
		// cell_up
		$up_url = array('action' => 'up', 'id' => $row[$model][$primary_key], 'autoPage' => TRUE);
		echo '<div class="cell cell_menu cell_up">' . $html->link($routine->icon('bullet_arrow_up'), $up_url, array('title' => __('up_action', TRUE), 'escape' => FALSE)) . '</div>';
	}
	if ($i === $num_rows - 1) {
		// cell_empty
		echo str_repeat('<div class="cell cell_empty cell_nbsp">&nbsp;</div>', 2);
	} else {
		// cell_down
		$down_url = array('action' => 'down', 'id' => $row[$model][$primary_key], 'autoPage' => TRUE);
		echo '<div class="cell cell_menu cell_down">' . $html->link($routine->icon('bullet_arrow_down'), $down_url, array('title' => __('down_action', TRUE), 'escape' => FALSE)) . '</div>';
		// cell_bottom
		$bottom_url = array('action' => 'bottom', 'id' => $row[$model][$primary_key], 'autoPage' => TRUE);
		echo '<div class="cell cell_menu cell_bottom">' . $html->link($routine->icon('bullet_arrow_bottom'), $bottom_url, array('title' => __('bottom_action', TRUE), 'escape' => FALSE)) . '</div>';
	}
}

// cell_delete
if (isset($field_schema['deleted'])) {
	$delete_url = array('action' => 'erase', 'id' => $row[$model][$primary_key], 'autoPage' => TRUE);
} else {
	$delete_url = array('action' => 'delete', 'id' => $row[$model][$primary_key], 'autoPage' => TRUE);
}
echo '<div class="cell cell_menu cell_delete">' . $html->link($routine->icon('delete'), $delete_url, array('title' => __('delete_action', TRUE), 'onclick' => 'return confirm(\'' . addslashes(__('are_you_sure', TRUE)) . '\');', 'escape' => FALSE)) . '</div>';

echo '</div>'; // end of right_cells


?>